#include "DataRun.h"

#include "UI/ModRun/Output/FactoryOutput.h"

DataRun::DataRun()
{
    m_strData = "";
    QString strOutput = "DataRun 构造:";
    qDebug() << strOutput;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutput };
        pOutPut->OutPut(outList);
    }
}

DataRun::~DataRun()
{
    QString strOutput = "DataRun 析构:";
    qDebug() << strOutput;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutput };
        pOutPut->OutPut(outList);
    }
}

void DataRun::SetData(QString strData)
{
    m_strData = strData;
}

void DataRun::Print()
{
    QString strThis = QString::number(reinterpret_cast<quintptr>(this), 16);
    QString strOutput = "DataRun Print:" + strThis + " :" + m_strData;
    qDebug() << strOutput;
    std::shared_ptr<IOutput> pOutPut = FactoryOutput::GetInstance()->CreateRunOutput();
    if (pOutPut)
    {
        std::initializer_list<QString> outList{ strOutput };
        pOutPut->OutPut(outList);
    }
}

std::unique_ptr<BaseData> DataRun::Clone()
{
    std::unique_ptr<DataRun> ptr = std::make_unique<DataRun>(*this);
    //进行深拷贝;
    return ptr;
}
